package cn.green.interaction.response.builder;

import cn.green.interaction.response.enums.InteractionResult;
import cn.green.interaction.response.module.HttpResponse;
import org.springframework.http.HttpStatus;

/**
 * 交互组件：HttpResponse响应模型建造者
 * @author wang.yishu
 */
public class HttpResponseBuilder {

    public static <T> HttpResponse<T> buildResponse(HttpStatus status, T t, String message, InteractionResult result) {
        HttpResponse response = new HttpResponse();
        response.setCode(status);//响应代码200
        response.setData(t);
        response.setMessage(message);
        response.setResult(InteractionResult.SUCCESS);
        return response;
    }
}
